package com.cdp.web.controller.system;

import com.cdp.common.core.domain.AjaxResult;
import com.cdp.common.core.domain.entity.SysRegion;
import com.cdp.system.dto.RegionDTO;
import com.cdp.system.service.IsysRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 地区信息
 */
@RestController
@RequestMapping("/system/region")
public class SysRegionController {


    @Autowired
    private IsysRegionService isysRegionService;


    @GetMapping("listRegions")
    public AjaxResult listRegions() {

        List<SysRegion> regionList = isysRegionService.listRegions();
        return AjaxResult.success(regionList);
    }


    /**
     * 地区模糊查询
     */

    @PostMapping("/listMistedRegions")
    public AjaxResult listMistedRegions(@RequestBody RegionDTO regionDTO ) {
        String regionName = regionDTO.getRegionName();
        List<SysRegion> regionList = isysRegionService.listMistedRegions(regionName);
        return AjaxResult.success(regionList);
    }






}
